/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */



/**
 *
 * @author tkor
 */
public abstract class SimpleThread extends Thread{

    private boolean running = false;

    private long timeout = 0;

    public SimpleThread(long milliseconds) {
        timeout = milliseconds;
    }

    public abstract void execute();

    public void run() {
        running = true;
        while(running) {
           execute();
           try {
                sleep(timeout);
           }catch(InterruptedException e) {
               //do nothing
           }
        }
    }
    public void stop() {
        running = false;
    }

}
